From 9dbf03cd23eed5f76cf7ede5217a9e4b9bd17eb5 Mon Sep 17 00:00:00 2001 From: Matthieu Gallien Date: Fri, 14 Feb 2025 11:40:00 +0100 Subject: [PATCH] provide consistent version info including human readable version should avoid displaying to an user a version number like 3.15.81 will remove some duplicated code should allow to always use same way to display to an user the version number will make "3.15.81" be shown as "3.16.0 rc1" Signed-off-by: Matthieu Gallien --- VERSION.cmake | 5 +++++ src/libsync/theme.cpp | 30 +++++++++++++++--------------- src/libsync/theme.h | 2 ++ version.h.in | 1 + 4 files changed, 23 insertions(+), 15 deletions(-) diff --git a/VERSION.cmake b/VERSION.cmake index 05cce3ba3..b94754771 100644 --- a/VERSION.cmake +++ b/VERSION.cmake @@ -33,6 +33,11 @@ set( MIRALL_VERSION_STRING ${MIRALL_VERSION} ) set( MIRALL_VERSION_FULL "${MIRALL_VERSION_FULL}.${MIRALL_VERSION_BUILD}" ) set( MIRALL_VERSION_STRING "${MIRALL_VERSION}${MIRALL_VERSION_SUFFIX}" ) +if(MIRALL_VERSION_PATCH VERSION_GREATER_EQUAL "50") + set (MIRALL_HUMAN_VERSION_STRING "3.17.0 alpha") +else() + set (MIRALL_HUMAN_VERSION_STRING ${MIRALL_VERSION_STRING}) +endif() if( MIRALL_VERSION_BUILD ) set( MIRALL_VERSION_STRING "${MIRALL_VERSION_STRING} (build ${MIRALL_VERSION_BUILD})" ) diff --git a/src/libsync/theme.cpp b/src/libsync/theme.cpp index f25ff9b58..8927f117f 100644 --- a/src/libsync/theme.cpp +++ b/src/libsync/theme.cpp @@ -410,6 +410,18 @@ Theme::Theme() #endif } +QString Theme::developerStringInfo() const +{ + // Shorten Qt's OS name: "macOS Mojave (10.14)" -> "macOS" + const auto osStringList = Utility::platformName().split(QLatin1Char(' ')); + const auto osName = osStringList.at(0); + + const auto devString = QString(tr("

%1 Desktop Client Version %2 (%3). For more information please click here.

", "%1 is application name. %2 is the human version string. %3 is the operating system name. %4 is the help URL")) + .arg(APPLICATION_NAME, QString::fromLatin1(MIRALL_HUMAN_VERSION_STRING), osName, helpUrl()); + + return devString; +} + // If this option returns true, the client only supports one folder to sync. // The Add-Button is removed accordingly. bool Theme::singleSyncFolder() const @@ -592,13 +604,8 @@ QString Theme::gitSHA1() const QString Theme::aboutInfo() const { - // Shorten Qt's OS name: "macOS Mojave (10.14)" -> "macOS" - QStringList osStringList = Utility::platformName().split(QLatin1Char(' ')); - QString osName = osStringList.at(0); - //: Example text: "

Nextcloud Desktop Client

" (%1 is the application name) - auto devString = QString(tr("

%1 Desktop Client

Version %1. For more information please click here.

") + QStringLiteral(" (%3)")) - .arg(APPLICATION_NAME, QString::fromLatin1(MIRALL_STRINGIFY(MIRALL_VERSION)), helpUrl(), osName); + auto devString = developerStringInfo(); devString += tr("

Using virtual files plugin: %1

").arg(Vfs::modeToString(bestAvailableVfsMode())); @@ -609,12 +616,7 @@ QString Theme::aboutInfo() const QString Theme::about() const { - // Shorten Qt's OS name: "macOS Mojave (10.14)" -> "macOS" - QStringList osStringList = Utility::platformName().split(QLatin1Char(' ')); - QString osName = osStringList.at(0); - - //: Example text: "

Nextcloud Desktop Client

" (%1 is the application name) - const auto devString = tr("

%1 desktop client %2

").arg(APPLICATION_NAME, QString::fromLatin1(MIRALL_STRINGIFY(MIRALL_VERSION))); + const auto devString = developerStringInfo(); return devString; } @@ -622,9 +624,7 @@ QString Theme::about() const QString Theme::aboutDetails() const { QString devString; - devString = tr("

Version %1. For more information please click here.

") - .arg(MIRALL_VERSION_STRING) - .arg(helpUrl()); + devString = developerStringInfo(); devString += tr("

This release was supplied by %1.

") .arg(APPLICATION_VENDOR); diff --git a/src/libsync/theme.h b/src/libsync/theme.h index 1c1416ef6..092fc112b 100644 --- a/src/libsync/theme.h +++ b/src/libsync/theme.h @@ -645,6 +645,8 @@ private: Theme(Theme const &); Theme &operator=(Theme const &); + [[nodiscard]] QString developerStringInfo() const; + void updateMultipleOverrideServers(); void connectToPaletteSignal() const; #if defined(Q_OS_WIN) diff --git a/version.h.in b/version.h.in index ba53a6545..3c80a9914 100644 --- a/version.h.in +++ b/version.h.in @@ -35,6 +35,7 @@ constexpr auto MIRALL_VERSION_SUFFIX = "@MIRALL_VERSION_SUFFIX@"; #cmakedefine MIRALL_VERSION_FULL @MIRALL_VERSION_FULL@ #cmakedefine MIRALL_VERSION_STRING "@MIRALL_VERSION_STRING@" +#cmakedefine MIRALL_HUMAN_VERSION_STRING "@MIRALL_HUMAN_VERSION_STRING@" constexpr int NEXTCLOUD_SERVER_VERSION_MIN_SUPPORTED_MAJOR = @NEXTCLOUD_SERVER_VERSION_MIN_SUPPORTED_MAJOR@; constexpr int NEXTCLOUD_SERVER_VERSION_MIN_SUPPORTED_MINOR = @NEXTCLOUD_SERVER_VERSION_MIN_SUPPORTED_MINOR@; -- 2.30.2